package com.word.app.config;

import java.util.ArrayList;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
        .apiInfo(apiInfo())
        .select()
        .apis(RequestHandlerSelectors.basePackage("com.word.app.controller"))
        .build();
    }

    private ApiInfo apiInfo(){
        return new ApiInfo(
            "在线学习系统", 
            "API文档", 
            "1.0", 
            "http://120.53.248.85:8081/", 
            new Contact("tanchenwei", "http://120.53.248.85:11464/", "970524265@qq.com"), 
            "apache 2.0", 
            "http://...", 
            new ArrayList());
    }
}
